package com.dengqi.mymodule.activity.update;

import android.os.Bundle;
import android.view.View;

import com.dengqi.mymodule.BaseActivity;
import com.dengqi.mymodule.R;

import androidx.annotation.Nullable;

/**
 * 第三方：https://www.jianshu.com/p/e246dd3b9c8a
 * Created by dell on 2018/6/15
 */

public class UpdateActivity extends BaseActivity {

    DownloadManagerUtil downloadManagerUtil;
    long downloadId = 0;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_update);
    }

    public void onBtn1(View view) {
        UpdateHelper.showDialogUpdate(this);
    }


    public void onBtn2(View view) {
        downloadManagerUtil = new DownloadManagerUtil(this);
        //影响自动安装
//        if (downloadId >0) {
//            downloadManagerUtil.clearCurrentTask(downloadId);
//        }
        downloadId = downloadManagerUtil.download("https://downpack.baidu.com/appsearch_AndroidPhone_v8.0.3(1.0.65.172)_1012271b.apk", "测试应用.apk", "下载完成后，点击安装");

    }


}
